﻿using System;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x020002FC RID: 764
	public class TIntoClause : TParseTreeNode
	{
		// Token: 0x17000621 RID: 1569
		// (get) Token: 0x06001B0D RID: 6925 RVA: 0x0032EC52 File Offset: 0x0032CE52
		// (set) Token: 0x06001B0C RID: 6924 RVA: 0x0032EC49 File Offset: 0x0032CE49
		public virtual bool BulkCollect
		{
			get
			{
				return this.bulkCollect;
			}
			set
			{
				this.bulkCollect = value;
			}
		}

		// Token: 0x17000622 RID: 1570
		// (get) Token: 0x06001B0F RID: 6927 RVA: 0x0032EC63 File Offset: 0x0032CE63
		// (set) Token: 0x06001B0E RID: 6926 RVA: 0x0032EC5A File Offset: 0x0032CE5A
		public virtual TObjectName IntoName
		{
			get
			{
				if (this.intoName != null)
				{
					return this.intoName;
				}
				return this.exprList.getExpression(0).ObjectOperand;
			}
			set
			{
				this.intoName = value;
			}
		}

		// Token: 0x17000623 RID: 1571
		// (get) Token: 0x06001B10 RID: 6928 RVA: 0x0032EC85 File Offset: 0x0032CE85
		// (set) Token: 0x06001B11 RID: 6929 RVA: 0x0032EC8D File Offset: 0x0032CE8D
		public virtual TExpressionList ExprList
		{
			get
			{
				return this.exprList;
			}
			set
			{
				this.exprList = value;
			}
		}

		// Token: 0x17000624 RID: 1572
		// (get) Token: 0x06001B12 RID: 6930 RVA: 0x0032EC96 File Offset: 0x0032CE96
		public virtual TSourceToken Filename
		{
			get
			{
				return this.filename;
			}
		}

		// Token: 0x06001B13 RID: 6931 RVA: 0x0032EC9E File Offset: 0x0032CE9E
		public override void init(object arg1)
		{
			if (arg1 is TExpressionList)
			{
				this.exprList = (TExpressionList)arg1;
				return;
			}
			if (arg1 is TSourceToken)
			{
				this.filename = (TSourceToken)arg1;
			}
		}

		// Token: 0x06001B14 RID: 6932 RVA: 0x0032ECCC File Offset: 0x0032CECC
		public override void doParse(TCustomSqlStatement psql, ESqlClause plocation)
		{
			if (this.exprList != null)
			{
				for (int i = 0; i < this.exprList.size(); i++)
				{
					TExpression expression = this.exprList.getExpression(i);
					if (expression.ExpressionType == EExpressionType.simple_object_name_t)
					{
						TObjectName objectOperand = expression.ObjectOperand;
						if ((psql.dbvendor == EDbVendor.dbvmssql || psql.dbvendor == EDbVendor.dbvgreenplum || psql.dbvendor == EDbVendor.dbvpostgresql || psql.dbvendor == EDbVendor.dbvsybase || psql.dbvendor == EDbVendor.dbvodbc) && !objectOperand.ToString().StartsWith("@"))
						{
							psql.addToTables(new TTable
							{
								TableName = objectOperand,
								TableType = ETableSource.objectname,
								EffectType = ETableEffectType.tetSelectInto
							});
						}
					}
					else
					{
						expression.doParse(psql, ESqlClause.selectInto);
					}
				}
			}
		}

		// Token: 0x06001B15 RID: 6933 RVA: 0x0032ED8E File Offset: 0x0032CF8E
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06001B16 RID: 6934 RVA: 0x0032ED9E File Offset: 0x0032CF9E
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x040019D9 RID: 6617
		private bool bulkCollect;

		// Token: 0x040019DA RID: 6618
		private TSourceToken filename;

		// Token: 0x040019DB RID: 6619
		private TExpressionList exprList;

		// Token: 0x040019DC RID: 6620
		private TObjectName intoName;
	}
}
